unit options;

interface

uses SysUtils, Forms, bass, Classes, Controls, StdCtrls, ComCtrls,
     windows, dialogs, Frame_Settings_General, ToolWin,
     Frame_Settings_Echo, Frame_Set_DataBase, Settings_Colors;

type
  TSettings = class(TForm)
    Button1: TButton;
    Button3: TButton;
    Button4: TButton;
    Frame_Set_Gen1: TFrame_Set_General;
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    Frame_Set_Echo1: TFrame_Set_Echo;
    ToolButton3: TToolButton;
    Frame_Set_DB1: TFrame_Set_DB;
    Set_Colors1: TSet_Colors;
    ToolButton4: TToolButton;
    procedure ToolButton3Click(Sender: TObject);
    procedure ToolButton2Click(Sender: TObject);
    procedure ToolButton1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TrackBar2Change(Sender: TObject);
    procedure TrackBar3Change(Sender: TObject);
    procedure TrackBar4Change(Sender: TObject);
    procedure TrackBar5Change(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure ToolButton4Click(Sender: TObject);
  private
    procedure SaveOptions;
  public
    FX: BASS_FXECHO;
  end;

var
  Settings: TSettings;

implementation

uses unit1, ComObj;

{$R *.dfm}

procedure TSettings.Button1Click(Sender: TObject);
begin
  SaveOptions;
  Close;
end;

procedure TSettings.ToolButton1Click(Sender: TObject);
begin
  Frame_Set_Echo1.Visible := False;
  Frame_Set_DB1.Visible := False;
  Set_Colors1.Visible := False;
  Frame_Set_Gen1.Visible := True;
end;

procedure TSettings.ToolButton2Click(Sender: TObject);
begin
  Frame_Set_Gen1.Visible := False;
  Frame_Set_DB1.Visible := False;
  Set_Colors1.Visible := False;
  Frame_Set_Echo1.Visible := True;
end;

procedure TSettings.ToolButton3Click(Sender: TObject);
begin
  Frame_Set_Gen1.Visible := False;
  Frame_Set_Echo1.Visible := False;
  Set_Colors1.Visible := False;
  Frame_Set_DB1.Visible := True;
end;

procedure TSettings.ToolButton4Click(Sender: TObject);
begin
  Frame_Set_Gen1.Visible := False;
  Frame_Set_Echo1.Visible := False;
  Set_Colors1.Visible := True;
  Frame_Set_DB1.Visible := False;

  Set_Colors1.Init;
end;

procedure TSettings.TrackBar1Change(Sender: TObject);
begin
  //Label1.Caption := IntToStr(TrackBar1.Position) + 'ms';
end;

procedure TSettings.FormShow(Sender: TObject);
begin
  Set_Colors1.Init;
{  TrackBar1.Position := BASS_GetConfig(BASS_CONFIG_BUFFER);
  Label1.Caption := IntToStr(TrackBar1.Position) + 'ms';
  TreeView1.FullExpand;
  GroupBox4.BringToFront;

  if Form1.Current_state.title = false
  then SpinEdit1.Value := 0
  else SpinEdit1.Value := Form1.titleshowtime;

  case Form1.pos of
    1: RadioButton1.Checked := true;
    2: RadioButton2.Checked := true;
    3: RadioButton3.Checked := true;
    4: RadioButton4.Checked := true;
  end; } 
end;

procedure TSettings.TrackBar2Change(Sender: TObject);
begin
  //Label6.Caption := IntToStr(TrackBar2.Position);
  //FX.fWetDryMix := TrackBar2.Position;
end;

procedure TSettings.TrackBar3Change(Sender: TObject);
begin
  //Label7.Caption := IntToStr(TrackBar3.Position);
  //FX.fFeedback := TrackBar3.Position;
end;

procedure TSettings.TrackBar4Change(Sender: TObject);
begin
  //Label8.Caption := IntToStr(TrackBar4.Position);
  //FX.fLeftDelay := TrackBar4.Position;
end;

procedure TSettings.TrackBar5Change(Sender: TObject);
begin
  //Label9.Caption := IntToStr(TrackBar5.Position);
  //FX.fRightDelay := TrackBar5.Position;
end;

procedure TSettings.CheckBox1Click(Sender: TObject);
begin
  //if CheckBox1.Checked = true
  //then FX.lPanDelay := true
  //else FX.lPanDelay := false;
end;

procedure TSettings.Button2Click(Sender: TObject);
begin
  //BASS_ChannelRemoveFX(Form1.CurrentStream, BASS_FX_ECHO);
  //BASS_ChannelSetFX(Form1.CurrentStream, BASS_FX_ECHO);
end;

procedure TSettings.SaveOptions;
begin
  Set_Colors1.Apply;

{  BASS_SetConfig(BASS_CONFIG_BUFFER, TrackBar1.Position);
  BASS_Update;
  if SpinEdit1.Value = 0 then Form1.Current_state.title := false
                         else Form1.Current_state.title := true;
  Form1.titleshowtime := SpinEdit1.Value;
  if RadioButton1.Checked = true
  then Form1.pos := 1
  else if RadioButton2.Checked = true
       then Form1.pos := 2
       else if RadioButton3.Checked = true
            then Form1.pos := 3
            else Form1.pos := 4;  }
end;

procedure TSettings.Button3Click(Sender: TObject);
begin
  SaveOptions;
end;

procedure TSettings.Button4Click(Sender: TObject);
begin
  Close;
end;

end.
